<%@page import="java.util.HashMap"%>
<%@ page contentType="text/html; charset=UTF-8" %> 
<%@page import="net.zhnb.util.*"%>
<%@ page import="net.zhnb.bean.*"%>
<%@page import="java.util.*"%>
<%@page import="finaler.util.PageList"%>
<%@page import="finaler.util.PageUtil"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="adminImport.jsp"/>
</head>
<%	PageList showerList =  (PageList) request.getAttribute("showerList");
	List<Room> roomList =  (ArrayList<Room>) request.getAttribute("roomList"); 
%>

<script>
	function checkForm(){
		if($("#showername").val()==''){
			alert("请输入展位名称!");
			return false;
		}
	}
	function del(id){
		if(confirm("确定吗!")){
			var url =  "<%=Constants.URL%>/admin/showerDel_"+id;
			window.location = url;
		}
	}
</script>

<body>

<a href="<%=Constants.URL %>/admin/menu">返回</a><br/><br/>


<!-- Table goes in the document BODY -->
<table class="hovertable">
	<tr>
	    <th>展位id</th><th>展位名称</th><th>所属场馆</th><th>该展位的广告欢迎图片</th><th>修改</th><th>删除</th>
	</tr>
	<%
	for( int i=0;i<showerList.getList().size();i++){
		Map<String,Object> shower = (HashMap<String,Object>) showerList.getList().get(i);
	%>
		<tr align="center" onmouseover="this.style.backgroundColor='#ffffff';" onmouseout="this.style.backgroundColor='#d4e3e5';">
		    <td><%=shower.get("id")%></td>
		    <td><%=shower.get("showername")%></td>
		    <td><%=shower.get("roomname")%></td>
		    <td><%=shower.get("showeradimg")==null||shower.get("showeradimg").toString().equals("")?"<b>暂无</b>":"<a href=\""+Constants.URL+"/upload/shower/"+shower.get("showeradimg")+"\" target=_blank><img  width=30 height=50 border=0 src=\""+Constants.URL+"/upload/shower/"+shower.get("showeradimg")+"\"/></a>"%>
		    	<form action="<%=Constants.URL %>/admin/showerUpload" id="<%=shower.get("id")%>form" name="<%=shower.get("id")%>form" enctype="multipart/form-data" method="post">
					<input type="hidden" value="<%=shower.get("id")%>"  id="showerid" name="showerid"/>
					选择展示广告:<input type="file" id="adimg" name="adimg" size="20"/><input type="submit" value="上传"/>
				</form>
		    
		    </td>
		    <td><a href="<%=Constants.URL %>/admin/showerModi_<%=shower.get("id")%>">修改</a></td>
		    <td><a href="###" onclick="del('<%=shower.get("id")%>')">删除</a></td>
		</tr>
	<%} %>
		<tr>
		    <td colspan="6">
				<%=PageUtil.getCurrPage(showerList)%>
				<%=PageUtil.getRecord(showerList)%>
				<%=PageUtil.getSinglePaginator(showerList,false)%>
		    </td>
		</tr>
</table>

<br/><br/>

<form action="<%=Constants.URL %>/admin/showerAdd" method="post" onsubmit="return checkForm()">
	展位名称<font color="red">*</font>:<input type="input" name="showername" id="showername"/><br/>
	所属场馆:<select name="roomid" id="roomid">
				<%for(Room room :roomList){ %>
					<option value="<%=room.getId()%>"><%=room.getRoomname()%></option>
				<%} %>
			</select><br/>
	<input type="submit" value="增加"/>
</form>

</body>
</html>